package zjitc.utils;

import zjitc.po.Book;

import java.util.List;

/**
 * Created by guo on 2018/4/17.
 */
public class PageBean {
    private int currentPage;//第几页
    private int pageSize;//当前页面数据条数

    //计算：count/pageSize
    private int pageCount;//一共多少页

    //从数据库查出
    private List<Book> pageList;//当前页的数据列表
    private int count;//数据库中一共多少条数据


    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    public List<Book> getPageList() {
        return pageList;
    }

    public void setPageList(List<Book> pageList) {
        this.pageList = pageList;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getPageCount() {
        //计算一共多少页
        int a = count / pageSize;
        pageCount = count % pageSize == 0 ? a : a + 1;
        return pageCount;
    }
}
